package com.homework.内部类;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class writecar {
  public static void main(String[] args) throws Exception {
    //
    try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("car.txt"));
        ObjectInputStream ois = new ObjectInputStream(new FileInputStream("car.txt"))) {
      Car.Tires[] tires = new Car.Tires[4];
      for (int i = 0; i < tires.length; i++) {
        tires[i] = new Car.Tires("米其林", 60);
      }
      oos.writeObject(new Car("奥迪", "A6", "白色", tires));
      Car car = (Car) ois.readObject();
      System.out.println(car);
    }
  }
}
